<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>折线图创建</title>
    <!-- 1、资源引入 -->
    <script type="text/javascript">
        window._AMapSecurityConfig = {
          securityJsCode:"ec8990c1cac6e2f42866a4f908a19989",
        }
      </script>
      <script type="text/javascript"
      src="https://webapi.amap.com/maps?v=2.0&key=1d8c4c24f36ffedf82812d42f9835ac9"></script> 
    <!-- 3、定义容器 -->
    <style>
        body,html,#container
        {
            width: 100%;
            height: 100%;
        }
        
    </style>
</head>
<body>
    <!-- 2、容器创建 -->
    <div id="container"></div>
    <!-- 4、创建地图变量 -->
    <script>
        var map=new AMap.Map('container',{
            center:[116.39, 39.9],
            zoom:10,
        })

        // 折线坐标数组
        //从前往后连接
        var path=[new AMap.LngLat(116.368904,39.913423),
        new AMap.LngLat(116.382122,39.901176),
        new AMap.LngLat(116.398258,39.904600),

        new AMap.LngLat(116.387271,39.912501),
        // new AMap.LngLat(116.398258,39.904600),
    ]
    //创建折线实例
    var polyline=new AMap.Polyline({
        path:path,
        borderWeigth:2,
        strokeColor:'red',
        lineJoin:'round'
    });

    map.add(polyline);
    </script>
</body>
</html>